#include <cstdlib>
#include <iostream>
/*
This program can be optimized further by using operator overloading,
and can be more easily maintained and scaled by creating
functions for input as well, but because of this simplicity
of this program it is completely unnecessary.

When used in overly simple programs classes will only
make your code seem "bloated", the main advantage of classes
is that it allows large amounts of code to be easily scaled and maintained.

Again - completely unnecessary in a program this simple.
Without using classes i've only written half the code, with twice
as much functionality. (38 lines vs 70 lines of code)
*/
using namespace std;

double cubeCalc(int l, int w, int h);
double rectCalc(int l, int w);

int main() {
    double width; //Local variable for width
    double length; //Local variable for length
	double height; //Local variable for height

	int option;
    //Get the rectangle's width and length from the user.
    cout << "Rectangle(1) or Cube(2)? :";
    cin >> option;

	cout << "What is the length? ";
    cin >> length;

    cout << "What is the width? ";
    cin >> width;

	if (option == 2) {
		cout << "What is the height? ";
		cin >> height;
	}

    if (option == 2) { cout << "Here is the cubes data:\n"; }
    else { cout << "Here is the rectangles data:\n"; }

	cout << "Length: " << length << endl;
    cout << "Width: " << width << endl;

    // If were calculating a cube, get the height.
    if (option == 2) { cout << "Height: " << height << endl; }

    cout<< "Area: ";
    // For cube -
    if (option == 2) { cout << cubeCalc(length, width, height) << endl; }

    // For rect -
	else { cout << rectCalc(length, width) << endl; }

    cin.get();
    return 0;
}

double cubeCalc(double l, double w, double h) {
	return l * w * h;
}

double rectCalc(double l, double w) {
	return l * w;
}
